/**
,editoptions:{size:12,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} 
,formoptions:{elmprefix:'(*)'}
, edittype:'select', editoptions:{value:{1:'One',2:'Two'}}
,editrules:{number:true}
**/
//一、工作人员（Duty Staff Lists）
$(document).ready(function(){	
	$("#list_dsl").jqGrid({
		url: '/ajax/ajax_zy_duty_staff.php?'+url_obj, //显示的数据
		editurl: '/ajax/ajax_zy_duty_staff.php?'+url_obj,
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)", "姓名(Name)","职务(Position)","到达日期(Arrived Date)","离开日期(Departure Date)","工作周期(Duty days)","健康状态(Health)","备注(Marks)","员工类型(Type)"], //表头标题别名
		colModel: [
			{name: 'ds_id', index: 'ds_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},			
			{name: 'name', index: 'name', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'worker', index: 'worker', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'arrived_date', index: 'arrived_date', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },
			{name: 'departure_date', index: 'departure_date', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },
			{name: 'duty_days', index: 'duty_days', width: 140, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'health', index: 'health', width: 140, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'info', index: 'info', width: 180, align: 'left',search:false, sortable:false,editable:true,edittype: 'textarea',editoptions:{rows:'3',cols:'30'}},
			{name: 'type', index: 'type', width: 180,editable:true, edittype:'select', editoptions:{value: "国际员工(International Employees):国际员工(International Employees);当地员工(Local employees):当地员工(Local employees)" }}
		],
		//postData:{project: global_project, week_time: global_week},
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false,
			id: "ds_id",
			cell: "cell", 
			userdata: "userdata"
		},
		//width: 600,
		height: 130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_dsl'),
		rowNum: 5, //每页显示记录数
		rowList:[5,10,20], //可调整每页显示的记录数
		sortname: 'ds_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_dsl").navGrid("#pager_dsl", {
			refresh: true,
			edit: false,
			add: true,
			del:true,
			search: false,
			//searchtext:'查找',
			position: "left"
		},{width:450,height:500,reloadAfterSubmit:false,closeOnEscape:true, closeAfterEdit: true}, // edit options
		{width:450,reloadAfterSubmit:true,closeAfterAdd: true}, // add options
		{mtype:"POST",reloadAfterSubmit: true}, // del options
		{multipleSearch:false,closeOnEscape:true,closeAfterSearch: true} // search options	
	);
});

//二、取证状态（Certificate Statistic）
$(document).ready(function(){	
	$("#list_cs").jqGrid({
		url: '/ajax/ajax_zy_certificate_statistic.php?'+url_obj, //显示的数据
		editurl: '/ajax/ajax_zy_certificate_statistic.php?'+url_obj,
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)", "姓名(Name)","取证类别(Certification Type)","取证日期(Date)","发证机构","证件有效期","取证地点","备注(Marks)","员工类型(Type)"], //表头标题别名
		colModel: [
			{name: 'cs_id', index: 'cs_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},			
			{name: 'name', index: 'name', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'cs_type', index: 'cs_type', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'cs_date', index: 'cs_date', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },			
			{name: 'authority', index: 'authority', width: 140, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'validity', index: 'validity', width: 140, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'cs_address', index: 'cs_address', width: 180, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'info', index: 'info', width: 180, align: 'left',search:false, sortable:false,editable:true,edittype: 'textarea',editoptions:{rows:'3',cols:'30'}},
			{name: 'dtype', index: 'dtype', width: 180,editable:true, edittype:'select', editoptions:{value: "国际员工(International Employees):国际员工(International Employees);当地员工(Local employees):当地员工(Local employees)" }}
		],
		//postData:{project: global_project, week_time: global_week},
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false,
			id: "cs_id",
			cell: "cell", 
			userdata: "userdata"
		},
		//width: 600,
		height: 130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_cs'),
		rowNum: 5, //每页显示记录数
		rowList:[5,10,20], //可调整每页显示的记录数
		sortname: 'cs_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_cs").navGrid("#pager_cs", {
			refresh: true,
			edit: false,
			add: true,
			del:true,
			search: false,
			//searchtext:'查找',
			position: "left"
		},{width:450,height:500,reloadAfterSubmit:false,closeOnEscape:true, closeAfterEdit: true}, // edit options
		{width:450,reloadAfterSubmit:true,closeAfterAdd: true}, // add options
		{mtype:"POST",reloadAfterSubmit: true}, // del options
		{multipleSearch:false,closeOnEscape:true,closeAfterSearch: true} // search options	
	);
});

//三、休假人员（Duty Off Staff Lists）
$(document).ready(function(){	
	$("#list_dosl").jqGrid({
		url: '/ajax/ajax_zy_duty_off_staff.php?'+url_obj, //显示的数据
		editurl: '/ajax/ajax_zy_duty_off_staff.php?'+url_obj,
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)", "姓名(Name)","职务(Position)","离开日期(Departure Date)","返回日期(Return Date)","休假周期(Vocation days)","健康状态(Health)","备注(Marks)","员工类型(Type)"], //表头标题别名
		colModel: [
			{name: 'dos_id', index: 'dos_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},			
			{name: 'name', index: 'name', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'worker', index: 'worker', width: 180,fixed:true, align: 'left', sortable:false,editable:true,editoptions:{size:30},editrules:{required:true}},
			{name: 'departure_date', index: 'departure_date', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },
			{name: 'return_date', index: 'return_date', width: 140, sortable:false,editable:true,editoptions:{size:30,readonly:true,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} },
			{name: 'vocation_days', index: 'vocation_days', width: 140, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'health', index: 'health', width: 140, sortable:false,editable:true,editoptions:{size:30}},
			{name: 'info', index: 'info', width: 180, align: 'left',search:false, sortable:false,editable:true,edittype: 'textarea',editoptions:{rows:'3',cols:'30'}},
			{name: 'type', index: 'type', width: 180,editable:true, edittype:'select', editoptions:{value: "国际员工(International Employees):国际员工(International Employees);当地员工(Local employees):当地员工(Local employees)" }}
		],
		//postData:{project: global_project, week_time: global_week},
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false,
			id: "dos_id",
			cell: "cell", 
			userdata: "userdata"
		},
		//width: 600,
		height: 130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_dosl'),
		rowNum: 5, //每页显示记录数
		rowList:[5,10,20], //可调整每页显示的记录数
		sortname: 'dos_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_dosl").navGrid("#pager_dosl", {
			refresh: true,
			edit: false,
			add: true,
			del:true,
			search: false,
			//searchtext:'查找',
			position: "left"
		},{width:450,height:500,reloadAfterSubmit:false,closeOnEscape:true, closeAfterEdit: true}, // edit options
		{width:450,reloadAfterSubmit:true,closeAfterAdd: true}, // add options
		{mtype:"POST",reloadAfterSubmit: true}, // del options
		{multipleSearch:false,closeOnEscape:true,closeAfterSearch: true} // search options	
	);
});